//
//  PrefixHeader.pch
//  doubleEduStudents
//
//  Created by 盛洋 on 2021/1/4.
//  Copyright © 2021 shengYang. All rights reserved.
//
#ifndef AppDevice_h
#define AppDevice_h

//#define GY_SERVER      @"http://209.103.181.218:8091"
#define GY_SERVER      @"http://api.aleph-star.com:8091"

#pragma mark -常用简化宏
//屏幕宽高
#define SCREEN_H       [[UIScreen mainScreen] bounds].size.height
#define SCREEN_W       [[UIScreen mainScreen] bounds].size.width

//collectionView的宽和高
#define CollectionView_Width    collectionView.frame.size.width
#define CollectionView_Height   collectionView.frame.size.height

//字体大小匹配
#define LabelFont1       [UIFont systemFontOfSize:([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone ? 20.0f : 40.0f)]
#define AutoLabFont1  [UIFont systemFontOfSize:kPro(9.0f)]//标题字体

#define LabelFont2       [UIFont systemFontOfSize:([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone ? 15.0f : 30.0f)]
#define AutoLabFont2  [UIFont systemFontOfSize:kPro(7.0f)]

#define LabelFont3       [UIFont systemFontOfSize:([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone ? 12.0f : 24.0f)]
#define AutoLabFont3  [UIFont systemFontOfSize:kPro(6.0f)]

#define LabelFont4       [UIFont systemFontOfSize:([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone ? 8.0f : 24.0f)]

#define AlertFont        [UIFont systemFontOfSize:([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone ? 16.0f : 26.0f)]

#define CodeFont       [UIFont systemFontOfSize:([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone ? 12.0f : 18.0f)]

//比例适配字体大小
#define kPro(num) (CGRectGetWidth([UIScreen mainScreen].bounds)/375.0f) * num

#define AutoLabSize(num)  [UIFont systemFontOfSize:kPro(num)]

//判断设备是否为手机
#define Is_iPhone  (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone)

//设备相关
#define Uuid             [[[[UIDevice currentDevice] identifierForVendor] UUIDString] stringFromMD5]

#define ssisAfterIOS7 ([[[UIDevice currentDevice] systemVersion] intValue]>=8)
#define ssisAfterIOS10 ([[[UIDevice currentDevice] systemVersion] intValue]>=10)
#define ssisAfterIOS11 ([[[UIDevice currentDevice] systemVersion] intValue]>=11)

#define ssiOS ([[[UIDevice currentDevice] systemVersion] floatValue])

#define ssisRetina ([[UIScreen mainScreen] scale]==2)
#define ssiPhone4 ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(640, 960), [[UIScreen mainScreen] currentMode].size) : NO)
#define ssiPhone5 ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(640, 1136), [[UIScreen mainScreen] currentMode].size) : NO)
#define ssiPhone6 ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(750, 1334), [[UIScreen mainScreen] currentMode].size) : NO)
#define ssiPhone6plus ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(1242, 2208), [[UIScreen mainScreen] currentMode].size) : NO)
#define ssiPhoneX ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(1125, 2436), [[UIScreen mainScreen] currentMode].size) : NO)
#define ssiPhoneXR ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(828, 1792), [[UIScreen mainScreen] currentMode].size) : NO)
#define ssiPhoneXP ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(1242, 2688), [[UIScreen mainScreen] currentMode].size) : NO)

//弹出信息
#define ssALERT(msg) [[[UIAlertView alloc] initWithTitle:nil message:msg delegate:nil cancelButtonTitle:@"知道了" otherButtonTitles:nil] show]


//App
#define ssApp ((AppDelegate *)[UIApplication sharedApplication].delegate)
#define FONT_NAME @"Helvetica Neue" //系统默认字体

#define IOS_VERSION     [[[UIDevice currentDevice] systemVersion] floatValue]//iOS版本

//简化 [NSUserDefaults standardUserDefaults]
#define NSUDSetValueWithKey(x,y)    [[NSUserDefaults standardUserDefaults] setObject:x forKey:y]
#define NSUDGetValueWithKey(x)      [[NSUserDefaults standardUserDefaults] valueForKey:x]

#define NSUDSetBool(x,y)                [[NSUserDefaults standardUserDefaults] setBool:x forKey:y]
#define NSUDGetBool(id)                 [[NSUserDefaults standardUserDefaults] boolForKey:id]
#define NSUDRemoveValueWithKey(x)       [[NSUserDefaults standardUserDefaults] removeObjectForKey:x];

//手机
#define NSUDSetPhone(id)                NSUDSetValueWithKey(id,@"user_phone")
#define NSUDGetPhone                    NSUDGetValueWithKey(@"user_phone")

//用户信息
#define NSUDSetPhoneUserInfo(id)        NSUDSetValueWithKey(id,@"PhoneUserInfo")
#define NSUDGetPhoneUserInfo            NSUDGetValueWithKey(@"PhoneUserInfo")

#define NSUDGetToken                    NSUDGetValueWithKey(@"Token")


//打印日志
#ifndef __OPTIMIZE__
# define NSLog(...) NSLog(__VA_ARGS__)
#else
# define NSLog(...) {}
#endif

#define GMLog(s,...)\
NSLog((@ s "  (%s [Line %d])\n "),##__VA_ARGS__, __PRETTY_FUNCTION__, __LINE__);
//[DataService deviceCompatibleNums:44 ip5:44 ip6:50 ip6p:50]    //底部工具条高度
#define MENU_H                  49

//状态栏的高度
#define STATUSBAR_H             [DataService GetStatusBarHeight]

//导航条的高度
#define NAVIGATION_H            44

 //状态栏+导航栏高度
#define StatusBarAndNavHeight  (Is_iPhone ? 64.0f : 100.0f)

//底部tabbar高度
#define TabbarHeight            49

 //底部安全区高度
#define STATUSBAR_BOTTOM_H     [DataService GetStatusBottomHeight]

//屏幕除去导航栏和状态栏高度
#define SPASE_H                (SCREEN_H-STATUSBAR_H-NAVIGATION_H)

//屏幕除去导航栏和状态栏以及tabbar高度
#define SPASE_1_H              (SPASE_H-MENU_H)

//导航栏标题长度
#define NavTitleMaxLength      [DataService GetNavMaxTitleLength]


//字体相关
#pragma mark --- 字体相关
#define FONT_NAV_TITLE  18.0f

//颜色相关
#pragma mark --------------------------------颜色相关

#define ssRGB(r, g, b)             [UIColor colorWithRed:((r) / 255.0) green:((g) / 255.0) blue:((b) / 255.0) alpha:1.0]
#define ssRGBAlpha(r, g, b, a)     [UIColor colorWithRed:((r) / 255.0) green:((g) / 255.0) blue:((b) / 255.0) alpha:(a)]
#define ssRGBHex(rgbValue) [UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 green:((float)((rgbValue & 0xFF00) >> 8))/255.0 blue:((float)(rgbValue & 0xFF))/255.0 alpha:1.0]
#define ssRGBHexAlpha(rgbValue,a) [UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 green:((float)((rgbValue & 0xFF00) >> 8))/255.0 blue:((float)(rgbValue & 0xFF))/255.0 alpha:(a)]

#define UIColorFromRGBA(rgbValue, alphaValue) [UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 green:((float)((rgbValue & 0x00FF00) >> 8))/255.0 blue:((float)(rgbValue & 0x0000FF))/255.0 alpha:alphaValue]
#define UIColorFromRGB(rgbValue) UIColorFromRGBA(rgbValue, 1.0)

#define COLOR_NAV_TITLE         ssRGBHex(0xFFFFFF)//导航栏字体白色
#define COLOR_NAV_LINE          ssRGBHex(0xFFFFFF)
#define COLOR_NAV_BG            ssRGBHex(0xFFFFFF)//导航背景色白色

//项目主体紫色
#define Base_lineColor     [UIColor colorWithHexString:@"8900BA"]
//红点颜色
#define RedCircle_Color         @"#fe585a"
//通用背景颜色颜色
#define Global_Back_Color       @"#f8f8f8"
//通用线框颜色(灰色未选中)
#define Unselect_line_Color     @"#E0E0E0"
//通用线框颜色(蓝色选中)
#define Select_line_Color       @"#4a90e2"
#define Global_Border_Color     @"#ffffff"

//文字定义
#pragma mark -文字定义
#define INTERMAKR     @"网络请求超时，请检查网络设置\n下拉重新加载数据"
#define INTERMAKR6    @"网络请求超时，请检查网络设置\n点击屏幕刷新"
#define INTERMAKR1    @"暂无消息"
#define INTERMAKR2    @"暂无收藏"
#define INTERMAKR4    @"没有搜索到您寻找的内容\n\n请换一个关键词试试吧"

#define TEXT_NET_SERVERERR     @"服务器开小差了"
#define TEXT_NET_NONETERR      @"网络不给力"

#define ForbiddenMsg         @"禁止输入表情"
#define ForbiddenMsg2        @"禁止输入表情,请修改"
#define RequestFaild         @"请求失败,请重试"

/** 通用加载loading页 */
#define xibNameTryAgain (SCREEN_W==320)?@"TryAgainView640":@"TryAgainView"


/** 解决block循环引用宏 */
#ifndef weakify
#if DEBUG
#if __has_feature(objc_arc)
#define weakify(object) autoreleasepool{} __weak __typeof__(object) weak##_##object = object;
#else
#define weakify(object) autoreleasepool{} __block __typeof__(object) block##_##object = object;
#endif
#else
#if __has_feature(objc_arc)
#define weakify(object) try{} @finally{} {} __weak __typeof__(object) weak##_##object = object;
#else
#define weakify(object) try{} @finally{} {} __block __typeof__(object) block##_##object = object;
#endif
#endif
#endif

#ifndef strongify
#if DEBUG
#if __has_feature(objc_arc)
#define strongify(object) autoreleasepool{} __typeof__(object) object = weak##_##object;
#else
#define strongify(object) autoreleasepool{} __typeof__(object) object = block##_##object;
#endif
#else
#if __has_feature(objc_arc)
#define strongify(object) try{} @finally{} __typeof__(object) object = weak##_##object;
#else
#define strongify(object) try{} @finally{} __typeof__(object) object = block##_##object;
#endif
#endif
#endif

// 默认图
#define DefaultIcon [UIImage imageNamed:@"default_icon"]
#define DefaultImg  [UIImage imageNamed:@"back_view"]
/** View圆角 描边 */
#define APPViewBorderRadius(View, Radius, Width, Color)\
\
[View.layer setCornerRadius:(Radius)];\
[View.layer setMasksToBounds:YES];\
[View.layer setBorderWidth:(Width)];\
[View.layer setBorderColor:[Color CGColor]]

/** 公共header(table的header)渐变值的设置 */
#define headerLbAlphaConstant   100


#endif /* AppDevice_h */
